﻿using Sustainalytics.ClientDW.Entities.Universes;
using Sustainalytics.Auth.Claims;
using System;
using System.Collections.Generic;
using System.IO;

namespace Sustainalytics.ClientDW.DataAccessLayer
{
    public interface IUniversesRepository
    {
        List<int> GetAllUniversesIds();
        bool IsProcessingScheduled();
        Tuple<Stream, Guid> UploadFile(Guid id, string fileName, string contentType);
        void AddUploadLogs(UploadLog uploadLog);
        void UpdateUploadLog(UploadLog uploadLog);
        void AddUploadErrorLog(UploadErrorLog uploadErrorLog);
        void AddFeatureUniverse(FeatureUniverse featureUniverse);
        void AddUniverse(Universe universe);
        void DeleteAllUniverseCompanies();
        void DeleteAllUniverses();
        void DeleteAllFeatureUniverses();
        void DeleteUniverse(int universeId);
        FeatureUniverse GetFeatureUniverse(Guid accountId, AccountFeature feature);
        List<FeatureUniverse> GetFeatureUniveseByAccountId(Guid accountId);
        byte[] GetFile(Guid fileId);
        Universe GetUniverse(string universeName, Guid AccountId);
        List<Universe> GetUniversesByAccountId(Guid accountId);

        List<Universe> GetUniversesEntitiesByNameForAccountId(Guid accountId, string univNameLike);

        int GetNextUniverseId();
        UniverseCompany GetUniverseCompany(Guid companyId, int universeId);
        List<UniverseCompany> GetAllCompanyUniverses(Guid companyId, DateTime lastUpdated);
        UploadLog GetUploadLog();
        List<UploadErrorLog> GetUploadErrorLogs();
        void UpdateFeatureUniverses(Guid accountId, AccountFeature feature, List<int> universeIds);

        List<UniverseCompany> GetUniverseCompanies(int universeId);
        void DeleteUniversesByAccountId(Guid accountId);
        void DeleteFeatureUniversesByAccountId(Guid accountId);
        void DeleteUniverseCompanyByAccountId(Guid accountId);
        void DeleteUniverseCompanyByAccountIds(List<Guid> accountIds);
        List<int> GetUniverseIdsByFeatureIds(int featureId, Guid? accountId = null);
        Dictionary<Guid, List<int>> GetAllUniverseCompany();

        List<Universe> GetAllUniversesIdsAndAccountIds();

        void InsertBatchUniverseCompany(List<UniverseCompany> universeCompanies);
        void AddUploadErrorBatchLog(List<UploadErrorLog> uploadErrorLogs);


        IEnumerable<Universe> GetUniversesIdNameByName(string universeName);
    }
}
